﻿
using System;

namespace Okarito
{
    /// <summary>
    /// The <see cref="WorkInterval"/> class represents a period of time spent working on a FogBugz bug.
    /// </summary>
    public sealed class WorkInterval
    {
        /// <summary>
        /// Gets the FogBugz Bug ID.
        /// </summary>
        /// <value>The bug ID.</value>
        public int BugId
        {
            get { return m_bugId; }
        }

        /// <summary>
        /// Gets the time at which work started.
        /// </summary>
        /// <value>The start time.</value>
        public DateTime Start
        {
            get { return m_start; }
        }

        /// <summary>
        /// Gets the time at which work ceased.
        /// </summary>
        /// <value>The end time.</value>
        public DateTime End
        {
            get { return m_end; }
        }

        /// <summary>
        /// Gets the duration of the work.
        /// </summary>
        /// <value>The duration.</value>
        public TimeSpan Duration
        {
            get { return m_end - m_start; }
        }

        internal WorkInterval(int bugId, DateTime start, DateTime end)
        {
            m_bugId = bugId;
            m_start = start;
            m_end = end;
        }

        readonly int m_bugId;
        readonly DateTime m_start;
        readonly DateTime m_end;
    }
}
